<?php

namespace app\proxy\controller\setting;

use app\proxy\controller\Controller;
use app\proxy\model\proxy\User as ProxyModel;

class Proxy extends Controller
{

    public function index()
    {
        $model = ProxyModel::detail($this->getProxyId());
        if ($this->request->isGet()) {
            return $this->renderSuccess('', compact('model'));
        }
        if ($model->edit($this->postData())) {
            return $this->renderSuccess('操作成功', compact('model'));
        }
        return $this->renderError($model->getError() ?: '保存失败');
    }
}